package wordAPI

import (
	"rewords-server-2024/internal/model/entity"
	"rewords-server-2024/internal/model/input/books_in"
	"rewords-server-2024/internal/model/input/query_in"
	"rewords-server-2024/internal/model/outin"

	"github.com/gogf/gf/v2/frame/g"
)

// BooksListReq 获取词书列表请求
type BooksListReq struct {
	g.Meta         `path:"/word/books/list" method:"post" summary:"获取词书列表" tags:"词书"`
	Conditions     []query_in.Condition  `json:"conditions,omitempty" summary:"查找条件"`   // 查找字段
	OrderFields    []query_in.OrderField `json:"order_fields,omitempty" summary:"排序字段"` // 排序字段
	*query_in.Page `json:"page"`                                                            // 分页
}

// BooksListRes 获取词书列表响应
type BooksListRes struct {
	List []entity.WordBook `json:"list"`
	query_in.PageResult
}

// BookAddReq 添加词书请求
type BookAddReq struct {
	g.Meta `path:"/word/books/add" method:"post" summary:"添加词书" tags:"词书"`
	entity.WordBook
}

// BookAddRes 添加词书响应
type BookAddRes struct {
	BookId string `json:"bookId" summary:"词书ID"`
}

// BookInfoReq 获取词书信息请求
type BookInfoReq struct {
	g.Meta `path:"/word/books/info" method:"get" summary:"获取词书信息" tags:"词书"`
	BookId string `json:"bookId" v:"required#词书ID不能为空" dc:"词书ID"`
}

// BookInfoRes 获取词书信息响应
type BookInfoRes struct {
	entity.WordBook
}

// BookUpdateReq 更新词书请求
type BookUpdateReq struct {
	g.Meta `path:"/word/books/update" method:"put" summary:"更新词书" tags:"词书"`
	entity.WordBook
}

// BookUpdateRes 更新词书响应
type BookUpdateRes struct{}

// BookDeleteReq 删除词书请求
type BookDeleteReq struct {
	g.Meta `path:"/word/books/delete" method:"delete" summary:"删除词书" tags:"词书"`
	BookId string `json:"bookId" v:"required#词书ID不能为空" dc:"词书ID"`
}

// BookDeleteRes 删除词书响应
type BookDeleteRes struct{}

// BookMiniReq 获取词书列表请求 用于其他 页面条件
type BookMiniReq struct {
	g.Meta `path:"/word/books/option" method:"get" summary:"获取词书列表" tags:"词书"`
}

// BookMiniRes 获取词书列表响应
type BookMiniRes struct {
	Data []outin.BookItem `json:"list"`
}

// BooksOriginReq 书源列表
type BooksOriginReq struct {
	g.Meta `path:"/word/books/origin" method:"get" summary:"获取词书原始数据列表" tags:"词书"`
}
type BooksOriginRes struct {
	Data []outin.BookOriginItem `json:"options"`
}
type BooksOriginAddReq struct {
	g.Meta `path:"/word/books/origin/add" method:"post" summary:"添加书源" tags:"词书"`
	books_in.BooksOriginAddInp
}
type BooksOriginAddRes struct{}

// BooksTagsReq 标签列表
type BooksTagsReq struct {
	g.Meta `path:"/word/books/tags" method:"get" summary:"获取词书标签列表" tags:"词书"`
}
type BooksTagsRes struct {
	Data []outin.BookTagItem `json:"options"`
}
type BooksTagsAddReq struct {
	g.Meta `path:"/word/books/tags/add" method:"post" summary:"添加标签" tags:"词书"`
	//books_in.BooksTagsAddInp
	Tag string `p:"tag_name" json:"tag_name" v:"required#标签不能为空" dc:"标签"`
	Url string `p:"tag_url" json:"tag_url" dc:"标签链接"`
}
type BooksTagsAddRes struct{}
